/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.patpro.DAO;

import com.patpro.entidades.Tipocontrato;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author EVELIN
 */
public class tipocontratoDAO {
     private EntityManagerFactory emf;
    private EntityManager em;
   public tipocontratoDAO() {
          this.emf = Persistence.createEntityManagerFactory("web-sicopPU");
        em=emf.createEntityManager();
    }
    
     public void closeEntityManager(){
    em.close();
    }
      public boolean insertartipocontrato(Tipocontrato t){
    boolean b=false;
    
    try{
    em.getTransaction().begin();
    em.persist(t);
    em.getTransaction().commit();
    b=true;
    
    
    }catch(Exception e){
    
    em.getTransaction().rollback();
    }
    return b;
    }
      
      
}
